<?php

namespace App\Models\Factory\V2;

use App\Constants\CreditLogConstant;
use App\Helpers\Utils;
use App\Models\AbsModelFactory;
use App\Models\Factory\IdentityFactory;
use App\Models\Orm\AwActivity;
use App\Models\Orm\AwUserInvite;
use App\Models\Orm\User;
use App\Models\Orm\User_credit_type;
use App\Models\Orm\UserBanks;
use App\Models\Orm\UserCertify;
use App\Models\Orm\UserCredit;
use App\Models\Orm\UserCreditLog;
use App\Models\Orm\UserCreditType;
use App\Models\Orm\UserCreditTypeUser;
use App\Models\Orm\UserIdentity;
use App\Models\Orm\UserInvite;
use App\Models\Orm\UserProfile;
use App\Strategies\CreditStrategy;


/**
 * 用户积分工厂
 * Class UserFactory
 * @package App\Models\Factory
 */
class UserCreditFactory extends AbsModelFactory
{

  public  static  function getUserStatus($user_id)
  {
	  $invite_num = AwUserInvite::where('user_id',$user_id)->count();

	  $data['status1'] = IdentityFactory::getIdentity($user_id);

	  switch ($invite_num)
	  {
	  case 0 :
		  $data['status2'] = 0;
		  $data['status3'] = 0;
		  $data['status4'] = 0;
		  break;
	  case 1 :
		  $data['status2'] = 1;
		  $data['status3'] = 0;
		  $data['status4'] = 0;
		  break;
	  case 2 :
		  $data['status2'] = 1;
		  $data['status3'] = 1;
		  $data['status4'] = 0;
		  break;
	  case 3 :
		  $data['status2'] = 1;
		  $data['status3'] = 1;
		  $data['status4'] = 1;
		  break;
	  default:
		  $data['status2'] = 1;
		  $data['status3'] = 1;
		  $data['status4'] = 1;
		  break;

	  }

	  return $data;
  }

}
